package rm.ep.shared;

import com.googlecode.objectify.annotation.Unindexed;


/**
 * This class has DELIBERATELY NO parent.
 * 
 * 
 * @author Riyaz Mansoor
 *
 */
@SuppressWarnings("serial")
public class FileEntity extends AbstractEntity {

	@Unindexed 
	private String fName;
	
	@Unindexed 
	private String fMimeType;
	
	@Unindexed
	private Integer fBlobSize;
	
	private Boolean fIsActive;
	
	protected FileEntity() {
		// required empty constructor
	}
	
	public FileEntity(String fileName, String mimeType, Integer blobSize) {
		fName = fileName;
		fMimeType = mimeType;
		fBlobSize = blobSize;
		fIsActive = Boolean.FALSE;
	}
	
	public String getFileName() {
		return fName;
	}
	
	public String getFileType() {
		return fMimeType;
	}
	
	public Integer getBlobSize() {
		return fBlobSize;
	}
	
	public Boolean isActive() {
		return fIsActive;
	}
	
	public void setActive(Boolean isActive) {
		fIsActive = isActive;
	}

	@Override
	public int hashCode() {
		return super.hashCode() + 13 * getClass().getName().hashCode();
	}
	
	@Override
	public boolean equals(Object obj) {
		if (this == obj) return true;
		if (obj instanceof FileEntity) {
			FileEntity that = (FileEntity) obj;
			return getId().equals(that.getId());
		}
		return false;
	}
	
}
